 <!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Settings</title>
<link href="css/style.css" rel="stylesheet" type="text/css">
<link href="file:///sdcard/TVATA/logo_img.css" rel="stylesheet" type="text/css" />
<link href="file:///sdcard/TVATA/bgimg.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./js/config.js"></script>
<script type="text/javascript" src="./js/libs/VatataPublic.js"></script>
<script type="text/javascript" src="./js/VatataTips/VatataTips.js"></script>
<script type="text/javascript" src="./js/libs/VatataKeyMove.js"></script>

<script type="text/javascript" src="./js/set.js"></script>

</head>

<body>
<div class="container">
	<div class="header_erji">
    	<div class="title fl">
            
        </div>
        <div class="now fr">
            <div class="clear"></div>
        </div>
    </div>
    

    <center>
	    <div id="initmsg"  style="font-size: 40px; margin-top: 30px;text-align: center;" >	
	        	Loading ... <span id="tcount"></span>
	    </div>
    </center>

<script>
    var main_hosturl = waeparams.getContentProviderPersistence("mainhosturl") ;
    var hurl = main_hosturl.replace("http://", "tva://" ) + "download/ZIP_CONFIG.xml#portal/html/index.html";


	{
		var retry_timeout = parseInt( sessionStorage.getItem("retry_timeout") );
		var retry_count = parseInt( sessionStorage.getItem("retry_count") );
		if ( isNaN(retry_timeout) ) retry_timeout = 60;
		if ( isNaN(retry_count) )   retry_count = 0;
		
		console.log( "retry_timeout: " + retry_timeout + " retry_count: " + retry_count );

		//retry_timeout += 20;
		sessionStorage.setItem("retry_timeout", retry_timeout);
		
		retry_count ++;
		sessionStorage.setItem("retry_count", retry_count);
		var tcounttotal = 0;

		function showmsg() {
			tcounttotal = 0;		
			
			var version = "未知版本";
			var app = null;
			try {
			        	app = wae.create("Application");
			        	version = app.versionName();
			}catch(e){ }

			var yes = confirm("应用系统[" + version + "]第" + retry_count + "次"
							+ "访问服务器数据失败，本次已等待"+retry_timeout+"秒无响应！\n"
							+ "请立即检查网络！\n\n立即重试请选择确定，如需检查网络请按取消！");

			if(yes){
				location.href = hurl;
			}else {
				location.href = "settings.html";
			}
		
		}

		
		//setTimeout( showmsg, retry_timeout * 1000 );
		
		var pkgObj = wae.create("WAE.AppPackage");
		
		setInterval( function() {
			tcounttotal++;
			var tcountr = retry_timeout - tcounttotal;
			var updatesec = pkgObj.getUpdateTime() / 1000;
			if ( updatesec >= retry_timeout ) {
				showmsg();
			}

			document.getElementById("tcount").innerHTML =  tcountr  +  " " + updatesec ;
		}, 1000 );
		
	}
	
	document.onkeydown = function(e) {
		location.href = hurl;
	}
		
    </script>    
    
</div>

<div class="aboute_container" id="aboutId" style="display:none">

   <div class="aboute_right">
    	   <div class="aboute_list">产品信息:</div>
           <div class="aboute_child">硬件版本<span>：3.0</span></div>
           <div class="aboute_child">软件版本：<span id="versionName">V1.1.0.1</span></div>
           <div class="aboute_line" style="margin-left:0px;"></div>
           <div class="aboute_list">联系我们:</div>
           <div class="aboute_child">Website：<span>http://www.tvata.com</span></div>
           <div class="aboute_child">QQ：<span>1583651202</span></div>
           <div class="aboute_child">E-mail：<span>sales@tvata.com</span></div>
       
           <div class="aboute_bottom">
               <span>天华雅歌  版权所有</span>
               <span>Copyright  ©2013  TVA  Corp.  All Rights  Reserved.</span>
           </div>
    </div>
  </div>
  

</body>
</html>
